import { Checkbox, Form, Radio, InputNumber, Button } from 'antd';
import type { CheckboxChangeEvent } from 'antd/es/checkbox';
import React from 'react';
import '../../styles/addLogistics.less';
import { history } from 'umi';

type Props = {}

const onChang = (e: CheckboxChangeEvent) => {
    console.log(`checked = ${e.target.checked}`);
};
//数字文本框
const onChange = (value: number | null) => {
    console.log('changed', value);
};

const addLogistics = (props: Props) => {
    const gotoBack = () => {
        history.push('/home/addText');
    }
    const gotoNext = () => {
        history.push('/home/commodity');
    }
    return (
        <div>
            <Form.Item label="物流方式：" valuePropName="checked">
                <Checkbox onChange={onChang}>快递</Checkbox>
                <Checkbox onChange={onChang}>到店核销</Checkbox>
            </Form.Item>
            <Form.Item label="运费设置">
                <Radio.Group>
                    <Radio value="apple"> 固定邮费 </Radio>
                    <Radio value="pear"> 运费模块 </Radio>
                </Radio.Group>
            </Form.Item>
            <Form.Item>
                <InputNumber min={0} max={100} defaultValue={0} onChange={onChange} className='InputNumber' />
            </Form.Item>
            <Form.Item className='but'>
                <Button type="primary" className='button' htmlType="submit" onClick={() => gotoBack()}>上一步</Button>
            </Form.Item>
            <Form.Item className='but'>
                <Button type="primary" className='butt' htmlType="submit" onClick={() => gotoNext()}>下一步</Button>
            </Form.Item>
        </div>
    )
}

export default addLogistics